<!DOCTYPE html>
<html lang="zh-CN">
    <head>
	<meta name="generator" content="Hugo 0.74.3" />
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="robots" content="noodp" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
        <title>记录我的折腾之路</title><meta name="Description" content="A blog recording my life"><meta property="og:title" content="记录我的折腾之路" />
<meta property="og:description" content="A blog recording my life" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://wlzx059.gitee.io/" />
<meta property="og:image" content="https://wlzx059.gitee.io/logo.png"/>
<meta property="og:updated_time" content="2020-11-22T11:40:00+08:00" />
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="https://wlzx059.gitee.io/logo.png"/>

<meta name="twitter:title" content="记录我的折腾之路"/>
<meta name="twitter:description" content="A blog recording my life"/>
<meta name="application-name" content="记录我的折腾之路">
<meta name="apple-mobile-web-app-title" content="记录我的折腾之路"><meta name="theme-color" content="#ffffff"><meta name="msapplication-TileColor" content="#da532c"><link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
        <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
        <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"><link rel="manifest" href="/site.webmanifest"><link rel="canonical" href="https://wlzx059.gitee.io/" /><link rel="alternate" href="/index.xml" type="application/rss+xml" title="记录我的折腾之路">
    <link rel="feed" href="/index.xml" type="application/rss+xml" title="记录我的折腾之路"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/normalize.css@8.0.1/normalize.min.css"><link rel="stylesheet" href="/css/style.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.13.0/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.7.2/animate.min.css"><script type="application/ld+json">
    {
        "@context": "http://schema.org",
        "@type": "WebSite",
        "url": "https:\/\/wlzx059.gitee.io\/","inLanguage": "zh-CN","author": {
                "@type": "Person",
                "name": "四不像程序猿"
            },"description": "A blog recording my life","image": {
                "@type": "ImageObject",
                "url": "https:\/\/wlzx059.gitee.io\/images\/Apple-Devices-Preview.png",
                "width":  3200 ,
                "height":  2048 
            },"thumbnailUrl": "https:\/\/wlzx059.gitee.io\/images\/screenshot.png","license": "This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.","name": "记录我的折腾之路"
    }
    </script></head>
    <body header-desktop="fixed" header-mobile="auto"><script type="text/javascript">(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('auto' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : 'auto' === 'dark')) && document.body.setAttribute('theme', 'dark');</script>

        <div id="mask"></div><div class="wrapper"><header class="desktop" id="header-desktop">
    <div class="header-wrapper">
        <div class="header-title">
            <a href="/" title="记录我的折腾之路"><span class="header-title-pre"><i class='far fa-kiss-wink-heart fa-fw'></i></span>四不像程序猿的博客</a>
        </div>
        <div class="menu">
            <div class="menu-inner"><a class="menu-item" href="/posts/"> 所有文章 </a><a class="menu-item" href="/tags/"> 标签 </a><a class="menu-item" href="/categories/"> 分类 </a><a class="menu-item" href="https://github.com/wlzx059" title="GitHub" rel="noopener noreffer" target="_blank"><i class='fab fa-github fa-fw'></i>  </a><span class="menu-item delimiter"></span><span class="menu-item search" id="search-desktop">
                        <input type="text" placeholder="搜索文章标题或内容..." id="search-input-desktop">
                        <a href="javascript:void(0);" class="search-button search-toggle" id="search-toggle-desktop" title="搜索">
                            <i class="fas fa-search fa-fw"></i>
                        </a>
                        <a href="javascript:void(0);" class="search-button search-clear" id="search-clear-desktop" title="清空">
                            <i class="fas fa-times-circle fa-fw"></i>
                        </a>
                        <span class="search-button search-loading" id="search-loading-desktop">
                            <i class="fas fa-spinner fa-fw fa-spin"></i>
                        </span>
                    </span><a href="javascript:void(0);" class="menu-item theme-switch" title="切换主题">
                    <i class="fas fa-adjust fa-fw"></i>
                </a>
            </div>
        </div>
    </div>
</header><header class="mobile" id="header-mobile">
    <div class="header-container">
        <div class="header-wrapper">
            <div class="header-title">
                <a href="/" title="记录我的折腾之路"><span class="header-title-pre"><i class='far fa-kiss-wink-heart fa-fw'></i></span>四不像程序猿的博客</a>
            </div>
            <div class="menu-toggle" id="menu-toggle-mobile">
                <span></span><span></span><span></span>
            </div>
        </div>
        <div class="menu" id="menu-mobile"><div class="search-wrapper">
                    <div class="search mobile" id="search-mobile">
                        <input type="text" placeholder="搜索文章标题或内容..." id="search-input-mobile">
                        <a href="javascript:void(0);" class="search-button search-toggle" id="search-toggle-mobile" title="搜索">
                            <i class="fas fa-search fa-fw"></i>
                        </a>
                        <a href="javascript:void(0);" class="search-button search-clear" id="search-clear-mobile" title="清空">
                            <i class="fas fa-times-circle fa-fw"></i>
                        </a>
                        <span class="search-button search-loading" id="search-loading-mobile">
                            <i class="fas fa-spinner fa-fw fa-spin"></i>
                        </span>
                    </div>
                    <a href="javascript:void(0);" class="search-cancel" id="search-cancel-mobile">
                        取消
                    </a>
                </div><a class="menu-item" href="/posts/" title="">所有文章</a><a class="menu-item" href="/tags/" title="">标签</a><a class="menu-item" href="/categories/" title="">分类</a><a class="menu-item" href="https://github.com/wlzx059" title="GitHub" rel="noopener noreffer" target="_blank"><i class='fab fa-github fa-fw'></i></a><a href="javascript:void(0);" class="menu-item theme-switch" title="切换主题">
                <i class="fas fa-adjust fa-fw"></i>
            </a></div>
    </div>
</header>
<div class="search-dropdown desktop">
    <div id="search-dropdown-desktop"></div>
</div>
<div class="search-dropdown mobile">
    <div id="search-dropdown-mobile"></div>
</div>
<main class="main">
                <div class="container"><div class="page home" posts><div class="home-profile"><div class="home-avatar"><a href="/posts/" title="所有文章"><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://gitee.com/wlzx059/picgo/raw/master/img/avatar.png"
        data-srcset="https://gitee.com/wlzx059/picgo/raw/master/img/avatar.png, https://gitee.com/wlzx059/picgo/raw/master/img/avatar.png 1.5x, https://gitee.com/wlzx059/picgo/raw/master/img/avatar.png 2x"
        data-sizes="auto"
        alt="https://gitee.com/wlzx059/picgo/raw/master/img/avatar.png"
        title="https://gitee.com/wlzx059/picgo/raw/master/img/avatar.png" /></a></div><h2 class="home-subtitle"><div id="id-1" class="typeit"></div></h2><div class="links"><a href="https://github.com/wlzx059" title="GitHub" target="_blank" rel="noopener noreffer me"><i class="fab fa-github-alt fa-fw"></i></a><a href="https://space.bilibili.com/327899189" title="bilibili" target="_blank" rel="noopener noreffer me"><i data-svg-src="/svg/icons/bilibili.min.svg"></i></a><a href="mailto:306606425@qq.com" title="Email" rel=" me"><i class="far fa-envelope fa-fw"></i></a><a href="/index.xml" title="RSS" target="_blank" rel="noopener noreffer me"><i class="fas fa-rss fa-fw"></i></a></div></div>
<article class="single summary" itemscope itemtype="http://schema.org/Article"><h1 class="single-title" itemprop="name headline">
        <a href="/posts/frontmatter%E5%92%8Cconfig-hugo%E7%9A%84%E5%8F%A6%E7%B1%BB%E6%95%B0%E6%8D%AE%E6%BA%90/">FrontMatter和Config--hugo的另类数据源</a>
    </h1><div class="post-meta"><span class="post-author"><a href="/" title="Author" rel=" author" class="author"><i class="fas fa-user-circle fa-fw"></i>四不像程序猿</a></span>&nbsp;<span class="post-publish">发布于 <time datetime="2020-11-22">2020-11-22</time></span>&nbsp;<span class="post-category">收录于 <a href="/categories/blog/"><i class="far fa-folder fa-fw"></i>blog</a></span></div><div class="content">转自https://hugo.aiaide.com/post/frontmatter%E5%92%8Cconfig/
FrontMatter和Config&ndash;hugo的另类数据源 作者编写的文章内容是hugo构建博客网站的主要数据来源, 但一个网站通常还需要其他的数据, 如 网站标题, 页面的SEO数据等, 但做为一个静态的博客系统, 这些数据是没办法存放在数据库的. FrontMatter和Config就是为解决这些问题的.
FrontMatter – 前置数据 FrontMatter添加在作者编写的文章内容前面的一段数据, 格式有yaml, toml, json. FrontMatter直译很难理解, 而他们都是以特定的数据格式出现在文章内容的顶部的, 为hugo生成静态页面提供数据来源的. 所以把他翻译为: 前置数据.
下面是前置数据的具体形式, yaml由---包裹, toml由+++包裹, json由{}包裹.
1 2 3 4 5 6 7 8 9 10  ---title:&#34;FrontMatter和Config--hugo的另类数据源&#34;date:2019-11-01T05:15:33+08:00draft:trueauthor:&#34;Suroppo&#34;tags:[]keywords:[]description:&#34;&#34;---文章内容.....  1 2 3 4 5 6 7 8 9 10  +++ title= &#34;FrontMatter和Config--hugo的另类数据源&#34; date= 2019-11-01T05:15:33+08:00 draft= true author= &#34;Suroppo&#34; tags= [] keywords= [] description= &#34;&#34; +++ 文章内容.....   1 2 3 4 5 6 7 8 9 10  { &#34;title&#34;: &#34;FrontMatter和Config--hugo的另类数据源&#34;, &#34;date&#34;: &#34;2019-11-01T05:15:33+08:00&#34;, &#34;draft&#34;: true, &#34;author&#34;: &#34;Suroppo&#34;, &#34;tags&#34;: [], &#34;keywords&#34;: [], &#34;description&#34;: &#34;&#34; } 文章内容.</div><div class="post-footer">
        <a href="/posts/frontmatter%E5%92%8Cconfig-hugo%E7%9A%84%E5%8F%A6%E7%B1%BB%E6%95%B0%E6%8D%AE%E6%BA%90/">阅读全文</a><div class="post-tags">
                <i class="fas fa-tags fa-fw"></i>&nbsp;<a href="/tags/gitee-picgo/">Gitee Picgo</a></div></div>
</article><article class="single summary" itemscope itemtype="http://schema.org/Article"><h1 class="single-title" itemprop="name headline">
        <a href="/posts/hugo%E7%9A%84%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86/">Hugo的工作原理</a>
    </h1><div class="post-meta"><span class="post-author"><a href="/" title="Author" rel=" author" class="author"><i class="fas fa-user-circle fa-fw"></i>四不像程序猿</a></span>&nbsp;<span class="post-publish">发布于 <time datetime="2020-11-22">2020-11-22</time></span>&nbsp;<span class="post-category">收录于 <a href="/categories/blog/"><i class="far fa-folder fa-fw"></i>blog</a></span></div><div class="content">Hugo的工作原理 转载于https://hugo.aiaide.com/post/hugo%E7%9A%84%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86/ 作为普通的作者如果知道文章内容如何转化成网站页面的, 会有利于更好的使用hugo. 如果还想修改一下页面布局样式, 那就更有必要知道hugo的工作原理了.
基本概念 文章, 页面, 模板
文章 文章就是作者需要撰写的内容, 他以markdown格式的文件存放在content目录下面. 我们既可以通过命令行的方式创建文章 hugo new about.md, 也可以通过手工的方式在content创建. 通常我们把单独的文章内容放在content目录下面, 同一类型的文章内容放在content的子目录下面, 这样做hugo会根据子目录下的内容自动生成列表内容.
页面 页面就是通过hugo 最终生成的静态网站中的html页面. 页面是由两部内容合成的, 即: 页面 = 文章 + 模板. hugo会根据一定的规制去寻找文章对应的模板页面, 从而生成页面.
模板 模板页面存放在两个地方
1 2 3 4 5 6 7 8 9 10 11 12 13 14  ├── layouts └── themes └── mytheme └── layouts ├── 404.html // 404页面模板 ├── _default │ ├── baseof.html // 默认的基础模板页, 使用的方式是&#39;拼接&#39;, 而不是&#39;继承&#39;.</div><div class="post-footer">
        <a href="/posts/hugo%E7%9A%84%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86/">阅读全文</a><div class="post-tags">
                <i class="fas fa-tags fa-fw"></i>&nbsp;<a href="/tags/gitee-picgo/">Gitee Picgo</a></div></div>
</article><article class="single summary" itemscope itemtype="http://schema.org/Article"><h1 class="single-title" itemprop="name headline">
        <a href="/posts/hugo%E6%A8%A1%E6%9D%BF%E7%9A%84%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95/">Hugo模板的基本语法</a>
    </h1><div class="post-meta"><span class="post-author"><a href="/" title="Author" rel=" author" class="author"><i class="fas fa-user-circle fa-fw"></i>四不像程序猿</a></span>&nbsp;<span class="post-publish">发布于 <time datetime="2020-11-22">2020-11-22</time></span>&nbsp;<span class="post-category">收录于 <a href="/categories/blog/"><i class="far fa-folder fa-fw"></i>blog</a></span></div><div class="content">Hugo模板的基本语法 转载于https://hugo.aiaide.com/post/hugo%E6%A8%A1%E6%9D%BF%E7%9A%84%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95/
hugo使用的是go语言自带的模板引擎, 模板的标签为{{}}, {{}}中包含的内容叫’动作’(action).
动作–action 动作分为两种类型
 数据求值 控制结构  求值的结果会直接输出到模板中, 控制结构主要包含条件, 循环, 函数调用等.
点. 1 2 3  {{.}} 点`.`代表传递给模板的数据, 表示当前模板的上下文, 他可以是go语言中的任何类型, 如: 字符串, 数组, 结构体等.   注释 1  {{/* comment */}}   空格处理 1 2 3 4 5 6 7 8  // 清除 pipeline 前后的空格 {{- pipeline -}} // 清除 pipeline 前面的空格 {{- pipeline }} // 清除 pipeline 后面的空格 {{ pipeline -}}   变量 1  {{$变量名 := &#34;值&#34;}}   条件判断 1 2 3 4 5 6 7 8  {{if pipeline}} T1 {{end}} 如果pipeline为空则不会输出任何结果, 否则输出T1.</div><div class="post-footer">
        <a href="/posts/hugo%E6%A8%A1%E6%9D%BF%E7%9A%84%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95/">阅读全文</a><div class="post-tags">
                <i class="fas fa-tags fa-fw"></i>&nbsp;<a href="/tags/hugo/">hugo</a></div></div>
</article><article class="single summary" itemscope itemtype="http://schema.org/Article"><h1 class="single-title" itemprop="name headline">
        <a href="/posts/git_err/">Git报错记录</a>
    </h1><div class="post-meta"><span class="post-author"><a href="/" title="Author" rel=" author" class="author"><i class="fas fa-user-circle fa-fw"></i>四不像程序猿</a></span>&nbsp;<span class="post-publish">发布于 <time datetime="2020-11-22">2020-11-22</time></span>&nbsp;<span class="post-category">收录于 <a href="/categories/blog/"><i class="far fa-folder fa-fw"></i>blog</a></span></div><div class="content">git add出现如下提示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  warning: LF will be replaced by CRLF in 404.html. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in categories/index.html. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in css/custom.css. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in css/style.</div><div class="post-footer">
        <a href="/posts/git_err/">阅读全文</a><div class="post-tags">
                <i class="fas fa-tags fa-fw"></i>&nbsp;<a href="/tags/git/">Git</a></div></div>
</article><article class="single summary" itemscope itemtype="http://schema.org/Article"><h1 class="single-title" itemprop="name headline">
        <a href="/posts/picgo_gitee/">PicGo &#43; Gitee(码云)实现markdown图床</a>
    </h1><div class="post-meta"><span class="post-author"><a href="/" title="Author" rel=" author" class="author"><i class="fas fa-user-circle fa-fw"></i>四不像程序猿</a></span>&nbsp;<span class="post-publish">发布于 <time datetime="2020-11-22">2020-11-22</time></span>&nbsp;<span class="post-category">收录于 <a href="/categories/blog/"><i class="far fa-folder fa-fw"></i>blog</a></span></div><div class="content">PicGo + Gitee(码云)实现markdown图床 参考链接https://www.jianshu.com/p/b69950a49ae2
注意事项：
插件安装不了：
npm 换淘宝源
1  npm config set registry https://registry.npm.taobao.org/    1 2  检查是否更新成功 npm config get registry   装的cnpm也不能下载的，真坑！@@ ！
图片上传后，结果发现要之前的不知到去哪里找。。。
https://gitee.com/wlzx059/picgo/raw/master/img/%E6%AD%A3%E5%9C%A8%E5%85%85%E7%94%B5%EF%BC%8C%E8%AF%B7%E5%8B%BF%E8%A7%A6%E6%91%B8.jpg
记住自己的仓库格式哈！拼接一下！没找到哪里有更好的办法。。。</div><div class="post-footer">
        <a href="/posts/picgo_gitee/">阅读全文</a><div class="post-tags">
                <i class="fas fa-tags fa-fw"></i>&nbsp;<a href="/tags/gitee-picgo/">Gitee Picgo</a></div></div>
</article><article class="single summary" itemscope itemtype="http://schema.org/Article"><h1 class="single-title" itemprop="name headline">
        <a href="/posts/git%E4%B8%8A%E4%BC%A0gitee/">Git上传到gitee</a>
    </h1><div class="post-meta"><span class="post-author"><a href="/" title="Author" rel=" author" class="author"><i class="fas fa-user-circle fa-fw"></i>四不像程序猿</a></span>&nbsp;<span class="post-publish">发布于 <time datetime="2020-11-22">2020-11-22</time></span>&nbsp;<span class="post-category">收录于 <a href="/categories/blog/"><i class="far fa-folder fa-fw"></i>blog</a></span></div><div class="content">git初次上传gitee 1 2 3 4 5  git init git add. git commit -m &#34;first commit&#34; git remote add origin 你的仓库地址 git push -u orgin master   git二次上传gitee 1 2 3  git add . git commit -m &#34;second commit&#34; git push   </div><div class="post-footer">
        <a href="/posts/git%E4%B8%8A%E4%BC%A0gitee/">阅读全文</a><div class="post-tags">
                <i class="fas fa-tags fa-fw"></i>&nbsp;<a href="/tags/git-gitee/">Git Gitee</a></div></div>
</article></div></div>
            </main><footer class="footer">
        <div class="footer-container"><div class="footer-line">由 <a href="https://gohugo.io/" target="_blank" rel="noopener noreffer" title="Hugo 0.74.3">Hugo</a> 强力驱动 | 主题 - <a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="noopener noreffer" title="LoveIt 0.2.10"><i class="far fa-kiss-wink-heart fa-fw"></i> LoveIt</a>
                </div><div class="footer-line"><i class="far fa-copyright fa-fw"></i><span itemprop="copyrightYear">2020</span><span class="author" itemprop="copyrightHolder">&nbsp;<a href="/" target="_blank">四不像程序猿</a></span></div>
        </div>
    </footer></div>

        <div id="fixed-buttons"><a href="#" id="back-to-top" class="fixed-button" title="回到顶部">
                <i class="fas fa-arrow-up fa-fw"></i>
            </a><a href="#" id="view-comments" class="fixed-button" title="查看评论">
                <i class="fas fa-comment fa-fw"></i>
            </a>
        </div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/lightgallery.js@1.2.0/dist/css/lightgallery.min.css"><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/smooth-scroll@16.1.3/dist/smooth-scroll.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/autocomplete.js@0.37.1/dist/autocomplete.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/algoliasearch@4.2.0/dist/algoliasearch-lite.umd.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lazysizes@5.2.2/lazysizes.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/twemoji@13.0.0/dist/twemoji.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lightgallery.js@1.2.0/dist/js/lightgallery.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lg-thumbnail.js@1.2.0/dist/lg-thumbnail.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lg-zoom.js@1.2.0/dist/lg-zoom.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/sharer.js@0.4.0/sharer.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/typeit@7.0.4/dist/typeit.min.js"></script><script type="text/javascript">window.config={"code":{"copyTitle":"复制到剪贴板","maxShownLines":10},"data":{"id-1":"A blog recording my life"},"lightGallery":{"actualSize":false,"exThumbImage":"data-thumbnail","hideBarsDelay":2000,"selector":".lightgallery","speed":400,"thumbContHeight":80,"thumbWidth":80,"thumbnail":true},"search":{"algoliaAppID":"EO42BFKWB5","algoliaIndex":"hugoblogloveit","algoliaSearchKey":"d3ef25fc7cb90a144ea0139748e4cf6b","highlightTag":"em","maxResultLength":10,"noResultsFound":"没有找到结果","snippetLength":50,"type":"algolia"},"twemoji":true,"typeit":{"cursorChar":"|","cursorSpeed":1000,"data":{"id-1":["id-1"]},"duration":-1,"speed":100}};</script><script type="text/javascript" src="/js/theme.min.js"></script><script type="text/javascript">
            window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());
            gtag('config', 'UA-105751499-1', { 'anonymize_ip': true });
        </script><script type="text/javascript" src="https://www.googletagmanager.com/gtag/js?id=UA-105751499-1" async></script></body>
</html>
